<div class='content_top'>
    <div class='frm_search'>
        <div class='search_menu'>
            <div class='search_menu_item active' rel='tour'>Tour</div>
            <div class='search_menu_item' rel='hotel'>Khách sạn</div>
            <div class='search_menu_item' onclick="window.location='/phuong-tien/du-lich-da-nang.html'" style='margin-right:0;'>Phương tiện</div>
            <div style='clear:both'></div>
        </div>
        <div class='search_content'>
            <? include('z_includes/tour_search.php'); ?>
        </div>
    </div>
    <div class='wrap_ads'>
    <?
	$category = new Category();
	$cnt = 0;
	$picture =  new Picture();
	$category->select(4);
	if ($category)
	{
		$tours = $category->getAllToursInCategory();
		foreach($tours as $tour)
		{
			$picture->select($tour->getads_picture());
			if ($picture)
			{
				$cnt ++;	
		?>
			<div class='ads_item'>
				<a href='/tour-chi-tiet/<?=$tour->getid()?>/<?=lg_string::get_link($tour->getname())?>'><img src='<?=$picture->getPath('tour_ads_')?>' /></a>
			</div>
		<?
				if ($cnt >= 3) break;
			}		
		}
	}
	?>
    </div>
    <div style='clear:both'></div>
</div><!--End content top-->   

<div class='content_center'>
    <div class='content_center_left'>
    <?
		$category_id = 1;
		$category->select($category_id);
		if ($category)
		{
		$tours = $category->getAllToursInCategory();
	?>
        <div class='title_1 cufon'>
            <?=$category->getname()?>
        </div>
        <div class='good_price_tours'>
        <?
            $cnt = 0;
            foreach ($tours as $tour)
            {
                $cnt ++;
				$picture->select($tour->getthm_picture());
				$currency = $tour->getCurrencyObj();
				
        ?>
            <div class='gp_tour_item'>
                <div class='gp_tour_img'>
                    <a href='/tour-chi-tiet/<?=$tour->getid()?>/<?=lg_string::get_link($tour->getname())?>'><img src='<?=($picture)?($picture->getPath("tour_price_")):""?>' /></a>
                    <div class='gp_tour_price'>
                        <?=lg_number::money($currency->getVND($tour->getRealPrice()))?> VNĐ
                    </div>
                    <?
					if ($tour->getpromotion() > 0)
					{
						echo "<div class='promotion'>".$tour->getpromotion()."<br />%</div>";
					}
					?>
                </div>
                <div class='gp_tour_content'>
                    <div class='gp_tour_title'>
                        <a href='/tour-chi-tiet/<?=$tour->getid()?>/<?=lg_string::get_link($tour->getname())?>'><?=$tour->getname()?></a>
                    </div>
                    <div class='gp_tour_desc'>
                    	<b>Ngày đi : <span style='color:#c00;'><?=lg_date::dmy2ymd($tour->getstart_date())?></span> - Ngày đến : <span style='color:#c00;'><?=lg_date::dmy2ymd($tour->getend_date())?></span> </b> <br />
                        <b>Số ngày : <span style='color:#c00;'><?=($tour->getnumber_day())?></span> - Số đêm : <span style='color:#c00;'><?=$tour->getnumber_night()?></span> </b> <br />
                        <b>Khởi hành : <span style='color:#c00;'><?=($tour->getDeparture()->getname())?></span> - Điểm đến : <span style='color:#c00;'><?=$tour->getDestination()->getname()?></span> </b> <br />
                        <?=lg_string::crop($tour->getoverview(),40)?>
                    </div>
                </div>
            </div>
        <?
				if ($cnt >= 7) break;
            }
        ?>
            <div class='view_more'>
                <a href='/tours/<?=$category->getid()?>/<?=lg_string::get_link($category->getname())?>'>Xem thêm &nbsp; &raquo;</a>
            </div>
        </div>
        <?
		}
		?>
    </div>
    
    <div class='content_center_right'>
    <?
		$category_id = 2;
		$category->select($category_id);
		if ($category)
		{
		$tours = $category->getAllToursInCategory();
	?>
        <div class='title_1 cufon'>
            <?=$category->getname()?>
        </div>
        <div class='tour_ideas'>
            <div class='tour_ideas_menu'>
            <?
				$cnt = 0;
				foreach ($tours as $tour)
				{
					$picture->select($tour->getthm_picture());
					if ($picture)
					{
			?>
                <div class='tour_ideas_menu_item <?=($cnt==0)?"active":""?>' rel='<?=$cnt?>'>
                    <?=$tour->getname()?>
                </div>
			<?
						$cnt ++;
						if ($cnt >= 8) break;
					}
				}
			?>
            </div>
            <?
				$cnt = 0;
				foreach ($tours as $tour)
				{
					$picture->select($tour->getthm_picture());
					if ($picture)
					{
						$currency = new Currency();
						$currency = $tour->getCurrencyObj();
			?>
	            <div class='tour_ideas_bg bg_active' rel='<?=$cnt?>'>
                    <img src='<?=$picture->getPath('tour_ideas_')?>' />
                    <div class='tour_ideas_main_content'>
                        <div class='tour_ideas_content'>
                            <div class='tour_ideas_title'><a href='/tour-chi-tiet/<?=$tour->getid()?>/<?=lg_string::get_link($tour->getname())?>'><?=$tour->getname()?></a></div>
                            <div class='tour_ideas_desc'>
                                <?=lg_string::crop($tour->getoverview(),25)?>
                            </div>
                        </div>
                        <div class='tour_ideas_wrap_price'>
                            <div>Giá từ</div>
                            <div class='gp_tour_price' style='width:85px;'><?=lg_number::money($currency->getVND($tour->getRealPrice()))?></div>
                        </div>
                    </div>
                </div>
			<?
						$cnt ++;
						if ($cnt >= 8) break;
					}
                }
            ?>
        </div>
        <?
		}
		?>
        
        <?
		$category_id = 3;
		$category->select($category_id);
		if ($category)
		{
		$tours = $category->getAllToursInCategory();
		?>
        <div class='title_2 cufon'><?=$category->getname()?></div>
        <div class='tour_last_wrap'>
        <?
            $cnt = 0;
			$location = new Location();
            foreach($tours as $tour)
            {
                $cnt ++;
				$tour_date = strtotime($tour->getstart_date());
				$location = $tour->getDestination();
				$currency = $tour->getCurrencyObj();
        ?>
            <div class='tour_last_item'>
                <div class='tour_last_title'>
                    <a href='/tour-chi-tiet/<?=$tour->getid()?>/<?=lg_string::get_link($tour->getname())?>'><?=(isset($location))?$location->getname():"" ?></a> - <span>Ngày <?=date('d/m',$tour_date)?></span>
                </div>
                <div class='tour_last_desc'>
                    <?=$tour->getname()?>
                </div>
                <div class='tour_last_price'>
                    <?=lg_number::money($currency->getVND($tour->getRealPrice()))?> VNĐ
                </div>
            </div>
        <?
				if ($cnt >= 11) break;
            }
        ?>
            <div class='view_more'>
                <a href='/tours/<?=$category->getid()?>/<?=lg_string::get_link($category->getname())?>'>Xem thêm &nbsp; &raquo;</a>
            </div>
        </div>
        <?
		}
		?>
    </div><!--End content right-->   
    <div style='clear:both'></div>
</div><!--End content center-->   

<div class='content_bottom'>
    <div class='content_bottom_item'>
        <div class='bottom_title cufon'>Tour được quan tâm nhất</div>
        <div class='content_bottom_main'>
        <?
			$tours = Tour::getAllTours();
            $cnt = 0;
            foreach($tours as $tour)
            {
                $cnt ++;
				$currency = $tour->getCurrencyObj();
        ?>
            <div class='content_bottom_main_item'>
                <div class='content_bottom_main_title'><a href='/tours/<?=$tour->getid()?>/<?=lg_string::get_link($tour->getname())?>'><span style='font-size:8px;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif'>> </span>&nbsp;<?=lg_string::crop($tour->getname(),10)?></a></div>
                <div class='content_bottom_main_desc'>Giá từ</div>
                <div class='content_bottom_main_price'><?=lg_number::money($currency->getVND($tour->getRealPrice()))?> VNĐ</div>
                <div style='clear:both'></div>
            </div>
        <?
				if ($cnt >= 6) break;
            }
        ?>
        </div>
    </div>
    
    <div class='content_bottom_item' style='margin:0 15px;'>
        <div class='bottom_title cufon'>Khách sạn tốt nhất</div>
        <div class='content_bottom_main'>
        <?
			$hotels = Hotel::getAllHotels();
            $cnt = 0;
            foreach($hotels as $hotel)
            {
                $cnt ++;
				$currency = new Currency();
				$currency->select($hotel->getCurrency());
        ?>
            <div class='content_bottom_main_item'>
                <div class='content_bottom_main_title'><a href='/hotel/<?=$hotel->getid()?>/<?=lg_string::get_link($hotel->getname())?>'><span style='font-size:8px;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif'>> </span>&nbsp;<?=lg_string::crop($hotel->getname(),10)?></a></div>
                <div class='content_bottom_main_desc'>Giá từ</div>
                <div class='content_bottom_main_price'><?=lg_number::money($currency->getVND($hotel->getPrice())*(100-$hotel->getPromotion())/100)?> VNĐ</div>
                <div style='clear:both'></div>
            </div>
        <?
				if ($cnt >= 6) 
					break;
            }
        ?>
        </div>
    </div>
    
    <div class='content_bottom_item'>
        <div class='bottom_title cufon'>Tour đặc trưng</div>
        <div class='content_bottom_main'>
        <?
			$category->select(4);
			$tours = $category->getAllToursInCategory();
		
            $cnt = 0;
            foreach($tours as $tour)
            {
                $cnt ++;
        ?>
            <div class='content_bottom_main_item'>
                <div class='content_bottom_main_title'><a href='/tours/<?=$tour->getid()?>/<?=lg_string::get_link($tour->getname())?>'><span style='font-size:8px;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif'>> </span>&nbsp;<?=lg_string::crop($tour->getname(),10)?></a></div>
                <div class='content_bottom_main_desc'>Giá từ</div>
                <div class='content_bottom_main_price'><?=lg_number::money($currency->getVND($tour->getRealPrice()))?> VNĐ</div>
                <div style='clear:both'></div>
            </div>
        <?
				if ($cnt >= 6)
            		break;
			}
        ?>
        </div>
    </div>
    <div style='clear:both'></div>
</div><!--End content bottom-->   